<template>
<!-- //1.导航区、展示区 2.请来路由器 3.制定路由的具体规侧 4.形成一个一个的【？？.vue】 
     -->
    <div class="app">
      <h2 class="title">vue 路由测试</h2>
      <!-- 导航区 -->
      <div class="navigate">
        <!-- <RouterLink to="/home" class="active">首页</RouterLink> -->
          <!-- RouterLink是组件不能写href -->
          <RouterLink to="/home" active-class="active">首页</RouterLink>
          <RouterLink to="news" active-class="active">新闻</RouterLink>
        <RouterLink to="about" active-class="active">关于</RouterLink>
       
      </div>
      <!-- 展示区 -->
      <div class="main-content">
        <!-- 这里展示各种组件，具体哪个组件要看路径 -->
         <RouterView>  </RouterView>
      </div>
    </div>
  </template>
  
  <script lang="ts" setup name="App">
  import { RouterView, RouterLink} from 'vue-router';
  </script>
  
  <style>
  .title {
    text-align: center;
    word-spacing: 5px;
    margin: 30px 0;
    height: 70px;
    line-height: 70px;
    background-image: linear-gradient(45deg, gray, white);
    border-radius: 10px;
    box-shadow: 0 2px;
    font-size: 30px;
  }
  
  .navigate {
    display: flex; /* 使导航链接在一排显示 */
    justify-content: center; /* 居中对齐 */
    gap: 10px; /* 添加链接之间的间距 */
  }
  
  .navigate a {
    display: block;
    text-align: center;
    width: 90px;
    height: 40px;
    line-height: 40px;
    border-radius: 10px;
    background-color: gray;
    text-decoration: none;
    color: white;
    font-size: 18px;
    letter-spacing: 5px;
  }
  
  .navigate a.active {
    background-color: #64967E;
    color: #ffc268;
    font-weight: 900;
    text-shadow: 0 1px black;
    font-family: 微软雅黑;
  }
  
  .main-content {
    margin: 0 auto;
    margin-top: 30px;
    border-radius: 10px;
    width: 90%;
    height: 400px;
    border: 1px solid;
  }
  </style>
  